// 模块化环境是commonjs规范  webpack devServer配置环境
// 此文件修改需要重启开发环境

// 起别名
const { createProxyMiddleware: proxy } = require('http-proxy-middleware')

module.exports = app => {
  // express中间件 express环境
  app.use('/api', proxy({
    target: 'http://localhost:8080',
    changeOrigin: true,
    pathRewrite: {
      '^/api': ''
    }
  }))
}
